from http.client import responses

from fastapi import APIRouter

from core.rag_core import rag_query_by_file
from entity.schema.model_schema import ModelInput
from entity.schema.rag_schema import RagInput
from utils.base_response import BaseResponse

rag = APIRouter()

@rag.post("/query")
async def rag_query(input: RagInput):
    """
    使用rag模型进行查询
    """
    result = await rag_query_by_file(input.api_key, input.user_input)
    return BaseResponse(code=200,msg="success", data=result)